SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tblRoles](
        [Role_PK] [int] IDENTITY(1,1) NOT NULL,
        [Role_Nombre] [nvarchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
        [Role_Habilitado] [bit] NOT NULL,
 CONSTRAINT [PK_tblRoles] PRIMARY KEY CLUSTERED 
(
        [Role_PK] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO


/****** Object:  Table [dbo].[tblUsuarios]    Script Date: 01/16/2013 14:02:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tblUsuarios](
        [Usr_PK] [int] IDENTITY(1,1) NOT NULL,
        [Usr_UsrName] [nvarchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
        [Usr_Pwd] [nvarchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
        [Usr_Nombre] [nvarchar](500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
        [Usr_Apellido] [nvarchar](500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
        [Usr_Email] [nvarchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
        [Usr_Role_FK] [int] NOT NULL,
        [Usr_Habilitado] [bit] NOT NULL,
 CONSTRAINT [PK_tblUsrs] PRIMARY KEY CLUSTERED 
(
        [Usr_PK] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

GO
ALTER TABLE [dbo].[tblUsuarios]  WITH CHECK ADD  CONSTRAINT [FK_tblUsuarios_tblRoles] FOREIGN KEY([Usr_Role_FK])
REFERENCES [dbo].[tblRoles] ([Role_PK])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[tblUsuarios] CHECK CONSTRAINT [FK_tblUsuarios_tblRoles]

GO

